#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

export PYTHONDONTWRITEBYTECODE=1

%:
	dh $@ --buildsystem meson

override_dh_auto_configure:
	dh_auto_configure -- -Dinit_system=systemd -Dlibexecdir=lib -Ddistro_templates=chef_client.rb.tmpl,chrony.conf.ubuntu.tmpl,hosts.debian.tmpl,ntp.conf.ubuntu.tmpl,sources.list.ubuntu.deb822.tmpl,sources.list.ubuntu.deb822.tmpl,timesyncd.conf.tmpl -Ddownstream_version=$(DEB_VERSION)

override_dh_auto_test:

ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	http_proxy= make PYVER=python3 check
else
	@echo check disabled by DEB_BUILD_OPTIONS=$(DEB_BUILD_OPTIONS)
endif

override_dh_installsystemd:
	dh_installsystemd --no-restart-on-upgrade --no-start

override_dh_auto_install:
	dh_auto_install --destdir=debian/cloud-init-base
	install -D -m 0644 ./tools/21-cloudinit.conf debian/cloud-init-base/etc/rsyslog.d/21-cloudinit.conf
	install -D ./tools/Z99-cloud-locale-test.sh debian/cloud-init-base/etc/profile.d/Z99-cloud-locale-test.sh
	install -D ./tools/Z99-cloudinit-warnings.sh debian/cloud-init-base/etc/profile.d/Z99-cloudinit-warnings.sh
